var api = require('../../utils/api.js');
var app = getApp();
Page({
    data: {
        tophe:0,
        dates:[],
        today:'1'
    },
    currentPageNumber: 1,
        onLoad() {
        var file=api.FIlE;
        this.setData({
            bg:file
        })
        var that=this;
        api.post({
            url: 'meeting/getmtdate',
            data: {},
            success: data => {


                var dates=data.data;
                console.log(dates);
               
                that.setData({
                    dates:data.data.all,
                    today:data.data.today
                });

                that.gettodayinfo();

            },
        });
       
    },
    onShow() {
        let jn = wx.getMenuButtonBoundingClientRect();

        console.log(jn);
        var tophe=jn.top+jn.height;
        var over =tophe+230 ;
        this.setData({
            tophe:tophe,
            top:jn.top
        })
     
    },

    gettodayinfo(){
        var that=this;
        var day=this.data.today;
        api.post({
            url: 'meeting/getmeetbyday',
            data: {day:day},
            success: data => {
                that.setData({
                    meeting:data.data
                });
            },
        });

    },
    qiandao(ret){
        console.log(ret);
        var that=this;
        var id=ret.currentTarget.dataset.id;

        wx.showModal({
          title: '签到',
          content: '确认签到？',
          complete: (res) => {
            if (res.confirm) {
                api.post({
                    url: 'meeting/qiandao',
                    data: {id:id},
                    success: data => {

                        wx.showToast({
                          title: data.msg,
                          icon:'none'
                        })
                       that.gettodayinfo();
                    },
                });
            }
          }
        })


    },
    getdays(ret){
        var i=ret.currentTarget.dataset.i;
        var list=this.data.dates;

        var today=i;
        this.setData({
            today:today,
            day:today
        })

        this.gettodayinfo();

    },

    seeinfo(ert){
        var id=ert.currentTarget.dataset.id;

        wx.navigateTo({
          url: '/pages/qiandao/info?id='+id
        })

    }



});
